package metrics;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;

import javax.swing.JFrame;

public class RecallGraph extends JFrame {
	Line2D y = new Line2D.Double(20, 580, 20, 20);
	Line2D x = new Line2D.Double(20, 580, 780, 580);
	int[] xvalues;
	int[] yvalues;

	


	public RecallGraph(NormalizedPRStatictic summary) {
		setBackground(Color.white);
		setSize(800, 600);
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		xvalues= new int[1+NormalizedPRStatictic.NORMALIZAION_PRECISION];
		yvalues= new int[1+NormalizedPRStatictic.NORMALIZAION_PRECISION];

		for (int i = 0; i <= NormalizedPRStatictic.NORMALIZAION_PRECISION; i++) {
			xvalues[i] = (int) (20+760*(float)i*(float)1/NormalizedPRStatictic.NORMALIZAION_PRECISION);
			yvalues[i] = (int) (20+560-560*summary.getPrecisionOfEntry(i));
		}
	}

	@Override
	public void paint(Graphics g) {
		Graphics2D graph = (Graphics2D)g;
		graph.setColor(Color.black);
		graph.setStroke(new BasicStroke(3));
		graph.draw(y);
		graph.draw(x);
		graph.setStroke(new BasicStroke(1));
		for (int i = 0; i <= 550; i+=112) {
			graph.drawLine(20, 580-i, 760, 580-i);
		}
		graph.setStroke(new BasicStroke(3));
		graph.setColor(Color.blue);
		graph.drawPolyline(xvalues, yvalues, NormalizedPRStatictic.NORMALIZAION_PRECISION+1);
	}
	
	

}